#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Time          : 2023/2/21 9:17
# File          : flask_api_first.py
# @Author       : MingTai
# @Department   : platform_qa
from flask import Flask, request
from flask import jsonify

# 第一个后端接口
app = Flask(__name__)


@app.route('/api/user', methods=['GET'])
def get_user():
    return jsonify(code=200, msg="用户查询成功！", username='张三', userphone='18288889999')


@app.route('/api/user_post', methods=['POST'])
def get_user_post():
    name = request.form.get('name')
    phone = request.form.get('phone')
    user_id = request.form.get('user_id')
    return jsonify(code=200, msg="用户查询成功！", username=name, userphone=phone, user_id=user_id)


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080, debug=True)
